package startup;

import java.io.*;

public class IOHelper {
	
	public static void createFile(String filename, String content){
		try {
			FileWriter writer = new FileWriter(filename);
			writer.write(content);
			writer.close();		
		} catch (IOException e) {
			
		}
	}
	
	public static void writeFile(String filename, String content){	
		try {
			FileWriter writer = new FileWriter(filename);
			writer.write(content);
			writer.close();
			
			
		} catch (Exception e) {
			createFile(filename, content);
		}
		
	}
	
	public static String readFile(String filename){
		File file = new File(filename);
		String s = null;
		
		try {
			FileReader fr = new FileReader(filename);
			BufferedReader br = new BufferedReader(fr);
			s = br.readLine();
			br.close();
			fr.close();
			
		} catch (Exception e) {
			
		}
		
		return s;
	}
}
